<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="何毓堂">
    <title></title>
    <link rel="stylesheet" type="" href="">
    <style>
        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
        }

        nav {
            width: 1200px;
            line-height: 600px;
            margin: 0 auto;
            text-align: center;
            background-color: violet;
        }

        div {
            width: 900px;
            height: 600px;
            line-height: 600px;
            background-color: hotpink;
            border: 2px solid hotpink;
            margin: 0 auto;
            border-radius: 50%;
            font-size: 30px;
            color: #228B22;
        }

        span {
            display: inline-block;
            width: 50px;
            height: 50px;
            color: aqua;
            font-size: 20px;
        }

        button {
            display: inline-block;
            width: 100px;
            height: 50px;
            background-color: #DC143C;
            border: 2px solid #DC143C;
            font-size: 20px;
            color: blanchedalmond;
        }
    </style>
</head>

<body>
    <nav>
        <div>
            <span>01</span>分
            <span>00</span>秒
            <button type="button">开始计时</button>
        </div>
    </nav>
</body>

</html>
<script>
    var spans = document.querySelectorAll("span");
    var button = document.querySelector(" button");
    var a = 1;
    var timer = null;
    var t = 59;
    button.onclick = function () {
        spans[0].innerHTML = "00";
        a++;
        if (a % 2 == 0) {
            button.innerHTML = "暂停开始";
            if (spans[0].innerHTML == 00) {
                sec();
            }
            timer = setInterval(sec, 1000);
        } else {
            button.innerHTML = "开始计时";
            clearInterval(timer);
            timer = null;
        }
    }
    function sec() {
        spans[1].innerHTML = t--;
        if (t == 0) {
            spans[1].innerHTML = "00";
            clearInterval(timer);
            timer = null;
        }
        if (t < 10) {
            spans[1].innerHTML = "0" + t;
        }
    }

</script>